import React, { lazy } from 'react'
import Root from '@/layout/root'
import {
  DashboardOutlined,
  LockOutlined,
  SettingOutlined,
  EditOutlined,
  BugOutlined
} from '@ant-design/icons'

type IRoutes = IRouter.Config.Route[]

const Dashboard = lazy(() => import('@/pages/Dashboard'))
const ArticleManage = lazy(() => import('@/pages/Article/Manage'))
const ArticleCreate = lazy(() => import('@/pages/Article/Create'))
const ArticleDetail = lazy(() => import('@/pages/Article/Detail'))

const RoleManage = lazy(() => import('@/pages/Role/Manage'))
const RoleAuth = lazy(() => import('@/pages/Role/Auth'))

const SystemModule = lazy(() => import('@/pages/System/Module'))
const SystemSeo = lazy(() => import('@/pages/System/Seo'))

const Log = lazy(() => import('@/pages/Log'))

const routes: IRoutes = [
  {
    label: '首页',
    key: 'dashboard',
    path: '/dashboard',
    element: <Dashboard />,
    icon: <DashboardOutlined />
  },
  {
    label: '文章管理',
    key: 'article',
    path: '/article',
    element: <Root />,
    icon: <EditOutlined />,
    children: [
      {
        label: '文章列表',
        key: 'article.manage',
        path: '/article/manage',
        element: <ArticleManage />
      },
      {
        label: '开始创作',
        key: 'article.create',
        path: '/article/create',
        element: <ArticleCreate />
      },
      {
        label: '文章详情',
        key: 'article.detail',
        path: '/article/detail',
        hidden: true,
        element: <ArticleDetail />
      }
    ]
  },
  {
    label: '权限管理',
    key: 'role',
    path: '/role',
    element: <Root />,
    icon: <LockOutlined />,
    children: [
      {
        label: '角色管理',
        key: 'role.manage',
        path: '/role/manage',
        element: <RoleManage />
      },
      {
        label: '权限管理',
        key: 'role.auth',
        path: '/role/auth',
        element: <RoleAuth />
      }
    ]
  },
  {
    label: '系统配置',
    key: 'system',
    path: '/system',
    element: <Root />,
    icon: <SettingOutlined />,
    children: [
      {
        label: 'SEO优化',
        key: 'system.seo',
        path: '/system/seo',
        element: <SystemSeo />
      },
      {
        label: '模块设置',
        key: 'system.module',
        path: '/system/module',
        element: <SystemModule />
      }
    ]
  },
  {
    label: '日志管理',
    key: 'log',
    path: '/log',
    element: <Log />,
    icon: <BugOutlined />
  }
]
export default routes
